<template>
  <div class="mobile-menu-fab" @click="toggleMenu">
    <i class="fas fa-plus" :class="getClass('rotated', showMenu)"></i>
    
    <div class="fab-menu" :class="getClass('active', showMenu)">
      <router-link to="/" class="fab-item" @click="closeMenu">
        <i class="fas fa-home"></i>
        <span>{{ t('home') }}</span>
      </router-link>
      
      <a href="#products" class="fab-item" @click="scrollToSection('products')">
        <i class="fas fa-box"></i>
        <span>{{ t('products') }}</span>
      </a>
      
      <a href="#ai-assistant" class="fab-item" @click="scrollToSection('ai-assistant')">
        <i class="fas fa-robot"></i>
        <span>{{ t('aiAssistant') }}</span>
      </a>
      
      <a href="#contact" class="fab-item" @click="scrollToSection('contact')">
        <i class="fas fa-phone"></i>
        <span>{{ t('contact') }}</span>
      </a>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useI18n } from '../composables/useI18n'

const { t } = useI18n()

const showMenu = ref(false)

const toggleMenu = () => {
  showMenu.value = !showMenu.value
}

const closeMenu = () => {
  showMenu.value = false
}

const scrollToSection = (sectionId) => {
  closeMenu()
  setTimeout(() => {
    const element = document.getElementById(sectionId)
    if (element) {
      element.scrollIntoView({ behavior: 'smooth' })
    }
  }, 100)
}

const getClass = (className, condition) => {
  return condition ? className : ''
}
</script>

<style scoped>
.mobile-menu-fab {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 1000;
  width: 56px;
  height: 56px;
  background: linear-gradient(45deg, #3498db, #2980b9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(52, 152, 219, 0.4);
  transition: all 0.3s ease;
}

.mobile-menu-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 6px 20px rgba(52, 152, 219, 0.6);
}

.mobile-menu-fab i {
  font-size: 1.5rem;
  transition: transform 0.3s ease;
}

.mobile-menu-fab i.rotated {
  transform: rotate(45deg);
}

.fab-menu {
  position: absolute;
  bottom: 70px;
  right: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.fab-menu.active {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.fab-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  background: white;
  color: #333;
  padding: 0.75rem 1rem;
  border-radius: 25px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  white-space: nowrap;
  font-size: 0.9rem;
}

.fab-item:hover {
  background: #f8f9fa;
  transform: translateX(-5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.fab-item i {
  font-size: 1rem;
  color: #3498db;
}
</style>
